<?php 

// No direct access
defined ('_JEXEC') or die();
JFormHelper::addFieldPath(JPATH_COMPONENT . '/models/fields');

$option = JRequest::getCmd('option');
$view = JRequest::getCmd('view');
$listOrder = $this->state->get('list.ordering');
$listDirn = $this->state->get('list.direction');
$status = JFormHelper::loadFieldType('status', false);
$statusOptions = $status->getOptions();
$web = JFormHelper::loadFieldType('Web', false);
$webOptions = $web->getOptions();

?>

<form action='index.php' method='post' name='adminForm' id='adminForm'>
	<input type="hidden" name="option" value="<?php echo $option; ?>" /> <input
		type="hidden" name="task" value="" /> <input type="hidden" name="view"
		value="<?php echo $view; ?>" /> <input type="hidden"
		name="filter_order" value="<?php echo $listOrder; ?>" /> <input
		type="hidden" name="filter_order_Dir" value="<?php echo $listDirn; ?>" />
	<input type='hidden' name='boxchecked' value='0' />
	<?php 
	echo JHtml::_('form.token');
	echo JHTML::_('behavior.modal');
	?>

	<fieldset id='filter-bar'>
		<div class='filter-select fltlft'>
			<select name='filter_status' class='inputbox'
				onchange='this.form.submit()'>
				<option value=''>
					<?php echo JText::_('JOPTION_SELECT_PUBLISHED');?>
				</option>
				<?php echo JHtml::_('select.options', $statusOptions, 'value', 'text', $this->state->get('filter.status'), true);?>
			</select> <select name='filter_web' class='inputbox'
				onchange='this.form.submit()'>
				<option value=''>
					<?php echo JText::_('- Select web -');?>
				</option>
				<?php echo JHtml::_('select.options', $webOptions, 'value', 'text', $this->state->get('filter.web'), true);?>
			</select>
		</div>
		<div class='filter-search fltlft'>
			<label for='filter_search'><?php echo JText::_('JSEARCH_FILTER_LABEL'); ?>
			</label> <input type='text' name='filter_search' id='filter_search'
				value='<?php echo $this->escape($this->state->get('filter.search')); ?>'
				title='<?php echo JText::_('Enter product name') ?>'
				placeholder="<?php echo JText::_('COM_SHIPNHANH_SHIPNHANH_SEARCH_TEXT_HOLDER')?>"
				size="80" />
			<button type='submit'>
				<?php echo JText::_('JSEARCH_FILTER_SUBMIT'); ?>
			</button>
			<button type='button'
				onclick='document.id("filter_search").value="";this.form.submit();'>
				<?php echo JText::_('JSEARCH_FILTER_CLEAR'); ?>
			</button>
		</div>
	</fieldset>

	<div class="clr"></div>

	<div id='editcell'>
		<table class='adminlist'>
			<thead>
				<tr>
					<th width='1%'><input type='checkbox'
						onclick='Joomla.checkAll(this)'
						title='<?php echo JText::_('Check all')?>' />
					</th>
					<th><?php echo JHtml::_('grid.sort', JText::_('COM_SHIPNHANH_ID_LABEL'), 'id', $listDirn, $listOrder)?>
					</th>
					<th><?php echo JHtml::_('grid.sort', JText::_('COM_SHIPNHANH_STATUS_LABEL'), 'status', $listDirn, $listOrder)?>
					</th>
					<th><?php echo JHtml::_('grid.sort', JText::_('COM_SHIPNHANH_ORDERDATE_LABEL'), 'orderdate', $listDirn, $listOrder); ?>
					</th>
					<th><?php echo JHtml::_('grid.sort', JText::_('COM_SHIPNHANH_CUSTOMER_LABEL'), 'customer', $listDirn, $listOrder)?>
					</th>
					<th><?php echo JHtml::_('grid.sort', JText::_('COM_SHIPNHANH_USORDERID_LABEL'), 'usorderid', $listDirn, $listOrder)?>
					</th>
					<th><?php echo JText::_('COM_SHIPNHANH_PRODUCTNAME_LABEL'); ?></th>
					<th><?php echo JHtml::_('grid.sort', JText::_('COM_SHIPNHANH_WEB_LABEL'), 'webname', $listDirn, $listOrder)?>
					</th>
					<th><?php echo JText::_('COM_SHIPNHANH_PHOTO_LABEL'); ?></th>
					<th><?php echo JText::_('COM_SHIPNHANH_COLOR_LABEL'); ?></th>
					<th><?php echo JText::_('COM_SHIPNHANH_SIZE_LABEL'); ?></th>
					<th>Số lượng</th>
					<th><?php echo JText::_('COM_SHIPNHANH_WEBPRICE_LABEL'); ?></th>
					<th><?php echo JText::_('COM_SHIPNHANH_TAX_LABEL'); ?></th>
					<th><?php echo JText::_('COM_SHIPNHANH_SHIPUS_LABEL'); ?></th>
					<th><?php echo JText::_('COM_SHIPNHANH_WEBCHARGE_LABEL'); ?></th>
					<th><?php echo JText::_('COM_SHIPNHANH_SHIPNHANH_SHIP_FEE_TOTAL'); ?>
					</th>
					<th><?php echo JText::_('COM_SHIPNHANH_SURCHARGE_LABEL'); ?></th>
					<th><?php echo JText::_('COM_SHIPNHANH_SHIPNHANH_TO_VND'); ?></th>
					<th><?php echo JText::_('COM_SHIPNHANH_NOTE_LABEL'); ?></th>
				</tr>
			</thead>
			<tfoot>
				<tr>
					<td colspan='20'><?php echo $this->pagination->getListFooter(); ?>
					</td>
				</tr>
			</tfoot>
			<tbody>
				<?php
				if (!empty($this->items))
				{
					$k = 0;
					$i = 0;
					foreach ($this->items as $row)
					{
						$checked = JHtml::_('grid.id', $i++, $row->id);
						$link = JRoute::_('index.php?option=' . $option . '&task=order.edit&id=' . $row->id);
						?>
				<tr class="row<?=$k?>">
					<td><?php echo $checked; ?></td>
					<td><a href='<?php echo $link; ?>'><?php echo $row->id; ?> </a></td>
					<td style="background-color:<?php echo $row->status_color?>"><?php echo $row->status; ?></td>
					<td><?php echo $row->orderdate; ?></td>
					<td><a class="modal" href='#<?php echo $row->username.$i; ?>'
						rel="{handler: 'clone'}"><?php echo $row->customer; ?> </a>
						<div style="display: none;">
							<div id="<?php echo $row->username.$i?>">
								<p>
									Phone: <a><?php echo $row->phone; ?> </a>
								</p>
								<p>
									Address: <a><?php echo $row->address; ?> </a>
								</p>
								<p>
									Email: <a><?php echo $row->email; ?> </a>
								</p>
							</div>
						</div>
					</td>
					<td><?php echo $row->usorderid; ?></td>
					<td><?php echo $row->productname; ?></td>
					<td><a href="<?php echo $row->link ?>"><?php echo $row->webname; ?>
					</a></td>
					<td><img src="<?php echo $row->photo; ?>"
						style="width: 100px; height: auto;" /></td>
					<td><?php echo $row->color; ?></td>
					<td><?php echo $row->size; ?></td>
					<td><?php echo $row->quantity; ?></td>
					<td><?php echo number_format($row->usprice, 2); ?></td>
					<td><?php echo $row->tax; ?></td>
					<td><?php echo number_format($row->shipus, 2); ?></td>
					<td><?php echo number_format($row->webcharge, 2);?></td>
					<td><?php echo number_format($row->fee, 2); ?></td>
					<td><?php echo number_format($row->surcharge, 2); ?></td>
					<td><?php echo number_format($row->vnprice, 2); ?></td>
					<td><?php echo $row->note; ?></td>
				</tr>
				<?php
			$k = 1 - $k;
			}
			}
			?>
			</tbody>
		</table>
	</div>
</form>
